package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {
        /**
         *
         */
        String[] s={"one","two","three","four","five"};
        for(int i=0;i<s.length;i++){
            System.out.println(s[i]);
        }

        //加强for循环
        for(String str : s){  //str表示的就是数组中的每个元素,相当于s[i]
            System.out.println(str);
        }

        Collection c=new ArrayList();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        Iterator it=c.iterator();
        while(it.hasNext()){
            String str=(String)it.next();
            System.out.println(str);
        }

        //加强for循环
        for(Object obj:c){
            System.out.println(obj);
        }







    }
}
